#pragma once
#include "def.h"
#include "context.h"
#include "ActionApiBase.h"
#include "agencyevent.h"


struct MatchSettlementParam
{
    std::int64_t currency_unit_multi;
    std::int64_t balance;
    std::int64_t withdraw_limit;
    std::int64_t valid_flow;
    std::uint32_t agency_id;
    std::uint64_t order_id;
    std::uint32_t game;
    std::uint64_t matchid;
    std::int64_t fee;
    std::int64_t reward;
    std::int64_t matchtime;
    std::uint32_t matchtype;
    std::int64_t withdraw_limit_ratio;
    std::int32_t matchform;
    std::int64_t totalfee;

    std::string agency;
    std::string currency;
    std::string username;

    MatchSettlementParam() :
        currency_unit_multi(0),
        balance(0),
        withdraw_limit(0),
        valid_flow(0),
        agency_id(0),
        order_id(0),
        game(0),
        matchid(0),
        fee(0),
        reward(0),
        matchtime(0),
        matchtype(0),
        withdraw_limit_ratio(0)
    {

    }
};

class ActionApiMatchSettlement : public ActionApiBase
{
public:
    static bool Init();
    
public:
    static void HandleMatchSettlement(MsgData&& msg_data);
public:
    static void OnAgencyGet(std::int32_t err_code, stAgencyEvent* agency, std::string&& trans);
protected:
    static void Request(const std::string& baseurl, const std::string& trans,
            std::uint32_t uid, std::uint16_t svtype, std::uint32_t svid, std::uint32_t uuid, std::uint32_t scene_from,
            const MatchSettlementParam& params);
};